﻿using System;
using System.Diagnostics;
using System.IO;
using System.Windows.Forms;
using SteamTools;
using Yak;

namespace Sagenhaft
{
    static class Program
    {
        /// <summary>
        /// Der Haupteinstiegspunkt für die Anwendung.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            if (SteamFolders.Steam == null)
            {
                if (MessageBox.Show("Steam not found, do you want to download the Steam installer?", "Sagenhaft", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    Process.Start(SteamStrings.DownloadURL);
                Application.Exit();
            }
            else
            {
                DriveInfo foo = new DriveInfo(Path.GetPathRoot(SteamFolders.Steam));
                if (!FSUtils.CanIWrite(SteamFolders.Common))
                {
                    MessageBox.Show("Need write privileges for " + SteamFolders.Common);
                    Application.Exit();
                }
                else if (foo.DriveType != DriveType.Fixed)
                {
                    MessageBox.Show(SteamFolders.Common + " must reside on a fixed drive");
                    Application.Exit();
                }
                else if (foo.DriveFormat != "NTFS")
                {
                    MessageBox.Show(SteamFolders.Common + " must reside on a NTFS drive");
                    Application.Exit();
                }
                else
                    Application.Run(new MainWindow());
            }
            
        }
    }
}
